//统一管理咱们项目商品分类相关的接口
import request from "@/utils/request"
//项目用户相关的请求地址
const API = {
  PRODUCT_CATEGORY_LIST_URL: "/super/systemProductCategory/list",
  PRODUCT_CATEGORY_STATUS_URL: "/super/systemProductCategory/statusChange",
  PRODUCT_CATEGORY_DETAIL_URL: "/super/systemProductCategory/detail",
  PRODUCT_CATEGORY_PARENTLIST_URL: "/super/systemProductCategory/getOneList",
  PRODUCT_CATEGORY_ADD_URL: "/super/systemProductCategory/add",
  PRODUCT_CATEGORY_EDIT_URL: "/super/systemProductCategory/edit",
  PRODUCT_CATEGORY_DEL_URL: "/super/systemProductCategory/del",
}

//获取商品分类列表
export const list = () =>
  request.get(API.PRODUCT_CATEGORY_LIST_URL)

//修改商品分类状态
export const statusChange = (data) =>
  request.post(API.PRODUCT_CATEGORY_STATUS_URL, data)

//获取商品分类详情
export const detail = (params) =>
  request.get(API.PRODUCT_CATEGORY_DETAIL_URL, { params })

//获取商品分类一级列表
export const parentList = () =>
  request.get(API.PRODUCT_CATEGORY_PARENTLIST_URL)

//添加商品分类
export const create = (data) =>
  request.post(API.PRODUCT_CATEGORY_ADD_URL, data)

//修改商品分类
export const update = (data) =>
  request.post(API.PRODUCT_CATEGORY_EDIT_URL, data)

//删除商品分类
export const destroy = (data) =>
  request.post(API.PRODUCT_CATEGORY_DEL_URL, data)
